package com.java.boot.controller;

import com.java.boot.bean.Person;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author jingjintao
 * @date 2021/8/1 - 16:39
 **/
@RestController
public class HelloController {

    //值不存在时，取后面的值
    @Value("${person.name:李四}")
    String name;
    @Autowired
    private Person person;

    @Value("${MAVEN_HOME}")
    private String msg;

    @Value("${os.name}")
    private String osName;
    @GetMapping("/")
    public String hello(){

        return "hello "+name;
    }

    @GetMapping("/person")
    public Person person(){
        return person;
    }

    @GetMapping("/msg")
    public String msg(){
        return msg+"==>"+osName;
    }
}
